using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Sysgeprava.Entities;

namespace Sysgeprava.Repository.Mapping
{
    public class DET_ESTABLOMap : EntityTypeConfiguration<DET_ESTABLO>
    {
        public DET_ESTABLOMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties

            // Table & Column Mappings
            this.ToTable("DET_ESTABLO");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.IdBovino).HasColumnName("IdBovino");
            this.Property(t => t.IdEstablo).HasColumnName("IdEstablo");
            this.Property(t => t.FecIngreso).HasColumnName("FecIngreso");

            // Relationships
            this.HasRequired(t => t.BOVINO)
                .WithMany(t => t.DET_ESTABLO)
                .HasForeignKey(d => d.IdBovino);
            this.HasRequired(t => t.ESTABLO)
                .WithMany(t => t.DET_ESTABLO)
                .HasForeignKey(d => d.IdEstablo);

        }
    }
}
